
\documentclass[a4paper]{article}
\usepackage{pgfplots}
\usepackage{pgfplots.assert}

\begin{document}

\tracingcommands=2\tracingmacros=2


\pgfplotssetcoordmathfor{x}{float}%
\pgfplotssetcoordmathfor{y}{float}%

\pgfkeys{
	/data point/x/.initial=,
	/data point/y/.initial=,
	/data point/expected x/.initial=,
	/data point/expected y/.initial=,
}

\def\test#1{%
	\pgfqkeys{/data point}{#1}%
	\message{#1 ^^J---->}
	\pgfplotsaxistransformcs
		{cart}
		{polar}%
	\pgfkeysgetvalue{/data point/x}\X
	\pgfkeysgetvalue{/data point/y}\Y
	\message{x=\X, y=\Y^^J^^J}
	\pgfplotsassertequalsfloat{\pgfkeysvalueof{/data point/expected x}}{\X}{}%
	\pgfplotsassertequalsfloat{\pgfkeysvalueof{/data point/expected y}}{\Y}{}%
}

\test{x=-0.5177465057770231, y= 0.0101010101010102,
 expected x=178.88233, % -- GNUPLOT
% expected x=179.53876,
 expected y=0.517845029569057,
}

\test{x=-0.5151515151515151, y= 0.0023567418021710,
 expected x=179.7378821324,
 expected y=0.5151569,
}

\test{x=-0.5110263651781155 , y=-0.0101010101010101,
 expected x=-178.867632018911, % GNUPLOT
 expected y=0.511126184334375,
}


\end{document}
